package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                                                                                                                                                import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.CustomerCrsReportMapper;
import com.ruoyi.bizsys.domain.CustomerCrsReport;
import com.ruoyi.bizsys.service.ICustomerCrsReportService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 用户CRS征信Service业务层处理
 *
 * @author african-loan
 * @date 2021-12-30
 */
@Service
public class CustomerCrsReportServiceImpl extends ServiceImpl<CustomerCrsReportMapper,CustomerCrsReport> implements ICustomerCrsReportService {

    /**
     * 查询用户CRS征信
     *
     * @param id 用户CRS征信ID
     * @return 用户CRS征信
     */
    @Override
    public CustomerCrsReport selectCustomerCrsReportById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询用户CRS征信列表
     *
     * @param customerCrsReport 用户CRS征信
     * @return 用户CRS征信
     */
    @Override
    public List<CustomerCrsReport> selectCustomerCrsReportList(CustomerCrsReport customerCrsReport) {
        return this.list(new QueryWrapper<>(customerCrsReport).last("order by id desc"));
    }

    /**
     * 新增用户CRS征信
     *
     * @param customerCrsReport 用户CRS征信
     * @return 结果
     */
            @Override
    public int insertCustomerCrsReport(CustomerCrsReport customerCrsReport) {
                                                                                                                                                                                                                                                                                                                                                                                        customerCrsReport.setCreateTime(DateUtils.getNowDate());
                                                                    return baseMapper.insert(customerCrsReport);
    }

    /**
     * 修改用户CRS征信
     *
     * @param customerCrsReport 用户CRS征信
     * @return 结果
     */
            @Override
    public int updateCustomerCrsReport(CustomerCrsReport customerCrsReport) {
                                                                                                                                                                                                                                                                                                                                                                                                                                customerCrsReport.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(customerCrsReport);
    }

    /**
     * 批量删除用户CRS征信
     *
     * @param ids 需要删除的用户CRS征信ID
     * @return 结果
     */
            @Override
    public int deleteCustomerCrsReportByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除用户CRS征信信息
     *
     * @param id 用户CRS征信ID
     * @return 结果
     */
    @Override
    public int deleteCustomerCrsReportById(Long id) {
        return baseMapper.deleteById(id);
    }

}
